<?php $this->load->view('navmenu');?>
<?php
	$atts = array(
            'width'      => '1024',
            'height'     => '768',
            'scrollbars' => 'yes',
            'status'     => 'yes',
            'resizable'  => 'yes',
            'screenx'    => '0',
            'screeny'    => '0'
            );
?>
<script type="text/javascript" charset="utf-8">
    // dynamic table
    jQuery('#dyntable').dataTable({
    "sPaginationType": "full_numbers",
    "aaSortingFixed": [[0,'asc']],
    "fnDrawCallback": function(oSettings) {
    jQuery.uniform.update();
    }
    });
</script>
<div class="maincontent">
        	<div class="contentinner">
			<?php foreach($threads as $trit):?>
					<?php
					if($trit['id_sd_thread']== $idThread)
					{
						$idProject=$trit['id_project_parent'];
					}
					?>
					<?php endforeach; ?>
			<?php
			if($this->session->userdata('level')==2)
			{
			?>
				 <ul class="list-nostyle list-inline">
				 <?php //echo $projectId;?>
                                            <li><a href="<?php echo base_url();?>index.php/project/formROW/<?php echo $idThread;?>/<?php echo $idProject;?>" class="btn btn-default btn-rounded"><i class="iconfa-upload"></i> Add New OR Add Revision</a></li>
                 </ul>
			<?php
			}
			?>
            	<h4 class="widgettitle">Daftar Request Of Work</h4>
            	<table class="table table-bordered" id="dyntable">
                    <thead>
                        <tr>
                            <th class="center">No</th>
                            <th class="center">No ROW</th>
                            <th class="center">ROW Reporter</th>
                            <th class="center">ROW Konsultan</th>
                            <th class="center">ROW Owner</th>
                            <th class="center">To</th>
                            <th class="center">Date Inspection</th>
                            <th class="center">Status</th>
                            <th class="center">Action</th>
                        </tr>
                    </thead>
                    <tbody>
					<?php $i=1;?>
					<?php foreach($request_of_works as $row):?>
					<?php
					if($row['verifier_konsultan'] == "" AND $row['verifier_mp'] == "")
					{
						$verifier_konsultan="BELUM DIREVIEW";
						$verifier_mp="BELUM DIREVIEW";
					}
					elseif($row['verifier_konsultan'] != "" AND $row['verifier_mp'] == "")
					{
						$verifier_konsultan=$row['verifier_konsultan'];
						$verifier_mp="BELUM DIREVIEW";
					}
					else
					{
						$verifier_konsultan=$row['verifier_konsultan'];
						$verifier_mp=$row['verifier_mp'];
					}
					?>
					<?php
					$countApprove = 0;
					$countROW = 0;
					foreach($approvals as $approve)
					{
						if($approve['id_sd_thread'] == $row['id_sd_thread'])
						{
							$countApprove++;
						}
					}
					?>
					<?php $jmlRow = count($threads);?>
                        <tr class="gradeX">
                            <td class="center"><?=$i?></td>
                            <td class="center"><?=$row['no_row']?></td>
                            <td class="center"><?=$row['username']?></td>
                            <td class="center"><?=$verifier_konsultan?></td>
                            <td class="center"><?=$verifier_mp?></td>
                            <td class="center"><?=$row['kepada']?></td>
                            <td class="center"><?=$row['date_inspection']?></td>
                            <td class="center"><?=$row['row_status']?></td>
                            <td class="center">
							
												<?php echo anchor_popup('project/showROWDetails/'.$row['id_row'], '<i class="btn btn-success btn-rounded">Show ROW Detail</i>', $atts); ?>
												</td>
                        </tr>
					<?php $i++;endforeach; ?>
                    </tbody>
                </table>
            </div><!--contentinner-->
        </div><!--maincontent-->
		